{% if field.widget.template in ('textinput', 'textarea') and field.widget.max_length %}
{% set ref = 'characterLimitInput' %}
{% endif %}

name="{{ field.name }}"
value="{{ cstruct }}"
id="{{ field.oid }}"
data-ref="{{ ref }} formInput"
class="form-input__input
      {% if field.widget.css_class %} {{ field.widget.css_class }} {% endif %}
      {% if field.widget.autofocus %} js-select-onfocus{% endif %}
      {% if field.schema.hint %} has-hint {% endif %}

      {# `has_label` is a flag provided by the containing widget's template (eg.
         `mapping_item`) which is rendering this field. #}
      {% if has_label %} has-label {% endif %}"
{%- if field.widget.size -%}
size="{{ field.widget.size }}"
{% endif -%}
{%- if field.schema.hint -%}
aria-describedby="hint-{{ field.oid }}"
{% endif -%}
{%- if field.error %}
aria-invalid="true"
{% endif -%}
{%- if field.widget.autofocus -%}
autofocus
{% endif -%}
{%- if field.widget.disable_autocomplete -%}
autocomplete="off"
{% endif -%}
{%- if field.widget.max_length -%}
data-maxlength="{{ field.widget.max_length }}"
{% endif -%}
{%- if field.widget.placeholder -%}
placeholder="{{ field.widget.placeholder }}"
{% endif -%}
{%- if field.required -%}
required
{% endif %}
